<template>
	<view class="income">
		<view class="nav_bar" style="background: linear-gradient( 179deg, #D5BBFF 0%, #E7DBFD 100%);">
			<uni-nav-bar color="#333" left-icon="left" title="观看时长" :border='false' :fixed="true"
				background-color="transparent" @clickLeft="$util.back()"></uni-nav-bar>
		</view>
		<view class="nav_box"></view>

		<view class="table">
			<view class="header flex_center">
				<view class="th">日期</view>
				<view class="th">观看时长</view>
			</view>

			<view class="tr flex_center" v-for="(item,index) in list" :key="index">
				<view class="th">{{item.create_time.split(' ')[0]}}</view>
				<view class="th">{{item.dur_watch_time}}</view>
			</view>
			<view style="background: #FFF;" v-if="!list.length">
				<empty></empty>
			</view>
		</view>

		<view class="page">
			<page-pagination :pageSize="20" v-show="total != 0" :total="total"  mode="multi" color="#6B37E2"
				@change="change"></page-pagination>
		</view>

	</view>
</template>

<script>
	import empty from '@/compentents/empty/empty.vue'
	export default {
		components: {
			empty
		},
		data() {
			return {
				user: {},

				list: [],
				page: 1,
				total: 0,
				price: '0.00',

			}
		},
		methods: {

			getList() {
				this.$get('/v2.guild_data/getLookTime', {
					page: this.page,
				}).then(res => {
					this.total = res.data.total;
					this.list = [];
					this.list.push(...res.data.data);
				})
			},

			change(e) {
				this.page = e;
				this.getList();
			}

		},

		onLoad() {
			this.user = uni.getStorageSync('user')
			this.getList();
		},
	}
</script>

<style lang="less" scoped>
	.income {
		min-height: 100vh;
		padding: 16rpx 32rpx 32rpx;
		background: linear-gradient(179deg, #D5BBFF 0%, #E7DBFD 16%, #F2F2F5 100%);
	}

	.table {
		border-radius: 24rpx;
		overflow: hidden;

		.header {
			background: linear-gradient(113deg, #AF65FF 0%, #6A83FF 100%);
			height: 64rpx;

			.th {
				flex: 1;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;
				line-height: 64rpx;
				text-align: center;
			}
		}

		.tr {
			height: 80rpx;
			background: #FFFFFF;
			border-top: 1rpx solid #FFCFED;

	

			.th {
				flex: 1;
				font-size: 28rpx;
				color: #333333;
				line-height: 80rpx;
				text-align: center;
			}
		}
	}
	
	.page {
		margin-top: 60rpx;
	}
</style>